package LayoutManager;
import java.awt.Button;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.util.concurrent.Flow;


public class FlowLayoutDemo2 {
    public static void main(String[] args) {
        Frame frame = new Frame("FlowLayout示例2");
        frame.setBounds(100,100,400,300);
        FlowLayout f1 = new FlowLayout(FlowLayout.LEFT,20,40);
        frame.setLayout(f1);

        /*FlowLayout f1 = new FlowLayout();
        f1.setAlignment(FlowLayout.LEFT);

        frame.setLayout(f1);*/
        frame.setBackground(Color.white);

        Button btn1 = new Button("button1");
        Button btn2 = new Button("button2");
        Button btn3 = new Button("button3");
        Button btn4 = new Button("button4");
        Button btn5 = new Button("button5");

        btn1.setBackground(Color.blue);
        btn2.setBackground(Color.gray);
        btn3.setBackground(Color.green);
        btn4.setBackground(Color.pink);
        btn5.setBackground(Color.yellow);

        frame.add(btn1);
        frame.add(btn2);
        frame.add(btn3);
        frame.add(btn4);
        frame.add(btn5);

        frame.setVisible(true);
    }
}
